﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PBOffice.DAL;

namespace PBOffice.BLL
{
   public  class MasterPageBLL
    {
        #region 查找出用户权限下可以操作的菜单
        /// <summary>
        /// 查找出用户权限下可以操作的菜单
        /// </summary>
        /// <param name="userNo">用户编号</param>
        /// <returns></returns>
        public static List<v_SelectUserRole> SelectMenuByUserNo(int userNo)
        {
            using (MyOfficeEntities myoffice = new MyOfficeEntities())
            {
                var userMenu = from m in myoffice.v_SelectUserRole
                               where m.UserNo ==userNo
                               select m;
                return userMenu.ToList();
            }
        } 
        #endregion

        #region 添加退出记录
        /// <summary>
        /// 添加退出日志
        /// </summary>
        /// <param name="longinLogs">登陆的时间</param>
        /// <param name="userNo">用户编号</param>
        public static void AddOutLoginLogs(DateTime longinLogs, User userNo)
        {
            int userNumber = Convert.ToInt32(userNo.UserNo);
            using (MyOfficeEntities myoffice = new MyOfficeEntities())
            {
                //调用存储过程，需要现在实体类框架中先导入存储过程
               //然后用下面的方法使用即可
                myoffice.sp_AddOutLoginlogs(userNumber, DateTime.Now, "退出登陆", longinLogs);
            }
        } 
        #endregion
    }
}
